package com.wjc.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
@ServletComponentScan //使用@ServletComponentScan 注解后，Servlet、Filter、Listener 可以直接通过 @WebServlet、@WebFilter、@WebListener 注解自动注册，无需其他代码
public class DemoApplication {

	public static void main(String[] args) {
		ApplicationContext ctx =SpringApplication.run(DemoApplication.class, args);
		//所有的bean,参考：http://412887952-qq-com.iteye.com/blog/2314051
		String[] beanNames = ctx.getBeanDefinitionNames();
		//String[] beanNames = ctx.getBeanNamesForAnnotation(RestController.class);//所有添加该注解的bean
		System.out.println("bean总数:{"+ctx.getBeanDefinitionCount()+"}");
		int i = 0;
		for (String str : beanNames) {
			System.out.println("{"+(++i)+"},beanName:{"+str+"}");
		}
	}

	/*public EmbeddedServletContainerCustomizer containerCustomizer(){
		return container -> {
			container.setSessionTimeout(7200);*//*单位为S*//*
		};
	}*/
}